<!-- 使用 type="home" 属性设置首页，其他页面不需要设置，默认为page；推荐使用json5，更强大，且允许注释 -->
<route lang="json5">
{
  style: {
    navigationStyle: 'custom',
    navigationBarTitleText: '首页',
    enablePullDownRefresh: false,
  },
}
</route>
<template>
  <view>
    <slot v-if="!isEmpty"></slot>
    <view v-if="loading || isEmpty" class="flex justify-center" :style="[marginStyle]">
      <wd-loading v-if="loading" />
      <wd-status-tip v-if="isEmpty && !loading" :image="statusType" :tip="statusTip" />
    </view>
  </view>
</template>

<script setup lang="ts">
const props = defineProps({
  statusType: {
    type: String,
    default: 'search',
  },
  statusTip: {
    type: String,
    default: '暂没有数据',
  },
  isEmpty: {
    type: [Boolean, Number],
    default: false,
  },
  marginTop: {
    type: String,
    default: '150rpx',
  },
  loading: {
    type: Boolean,
    default: false,
  },
})
const marginStyle = computed(() => ({ padding: `${props.marginTop} 0` }))
</script>
<script lang="ts">
export default {
  options: {
    virtualHost: true,
  },
}
</script>
<style lang="scss" scoped></style>
